package com.activitys;

import android.view.View;

/**
 * 禁止短时间重复点击
 */
public abstract class OnForbidClickListener implements View.OnClickListener {
    private long mLastClickTime;
    private long timeInterval = 1000L;

    public OnForbidClickListener() {}

    @Override
    public void onClick(View v) {
        long nowTime = System.currentTimeMillis();
        if (nowTime - mLastClickTime > timeInterval) {
            onClicks(v);
            mLastClickTime = nowTime;
        }
    }

    protected abstract void onClicks(View v);
}
